import {View, Image, Text, Block} from '@tarojs/components';
import {AtIcon, AtFloatLayout, AtModal, AtModalHeader, AtModalContent, AtModalAction} from "taro-ui";
import React, { useState } from 'react';
import Taro, {useDidShow} from '@tarojs/taro';
import {ScenicGood} from "../../../utils/server.interface";
import {ACTIVITY_CHECK, JORN_CAR, OPEN_ACTIVITY_CHECK} from '../../../constants/api';
import {http} from "../../../utils/http";
import {GetRequest} from '../../../utils/tools';
import {user} from "../../../utils/user.service";
import {platform} from "../../../utils/platform-settting.service";
import './detail-bar.scss';

interface DetailBarType {
  isShowShareButton?: any
  limitGoodsId?: any
  goodsDiscountCodeType?: any
  goodsDiscountCodeId?: any
  onOpenModel?: any
  handleCancel?: any
  qrImg?: any
  onGetPoster?: any
  groupBuyId?: any
  info?: any
  onGotoBuy?: any
  onGotoCar?: any
  onUpdata?: any
  onOffCar?: any
  weChat?: any
  onContact?: any
  showService?: any
  fromOrderNum?: any
  isPub?: number
  isSeller?: number
  good: Object
  productId: string
  carSum: number
  num?: number
  isSale?: number
  goods: ScenicGood[]
  groupDetail?: any
  platformSet?: any
  isOpened: boolean
  isLogin: boolean
  orderCar?: {
    forCar: boolean
    isOpen: boolean
    index: number
  }
  thisIndex: number
  itemId: any
  commissionPrice: any
  canpay?: boolean
  leader?: boolean
  tempSellerId?: string
  goodUuid?: string
  forcePlatformSeller?: any
}

const OtherCar: React.FC<DetailBarType> = (props) => {
  const [isOpened, setIsOpened] = useState(props.isOpened)
  const [index, setIndex] = useState(props.thisIndex)
  const [value, setValue] = useState(1)
  const [isLeader, setIsLeader] = useState(props.leader)
  const [id, setId] = useState(0)
  const [displayIndex, setDisplayIndex] = useState(0)
  const [displayIndexTwo, setDisplayIndexTwo] = useState(0)
  const [type, setType] = useState(1)
  const [modalShow, setModalShow] = useState(false);
  if (props.orderCar.forCar) {
    setType(props.orderCar.type)
    setIsOpened(props.orderCar.isOpen)
    setIndex(props.orderCar.index)
    if (props.goods[index] && props.goods[index].isGoodsDayInfo != 1) {
      for (let i = 0; i < props.goods.length; i++) {
        if (props.goods[i].isGoodsDayInfo == 1) {
          setIndex(i)
          break;
        }
      }
    }
    setValue(props.goods[index].buy_num_max >= 1 ? (props.goods[index].buy_num_min ? props.goods[index].buy_num_min : 1) : 0)
    props.onOffCar()
  }

  useDidShow(() => {
    setIsOpened(false)
    setValue(props.goods[index].buy_num_max >= 1 ? (props.goods[index].buy_num_min ? props.goods[index].buy_num_min : 1) : 0)

  })
  const handleClose = () => {
    setIsOpened(false)
  }

  const checkJump = () => {
    if (Taro.getCurrentInstance().router.params.pkeys) {
      Taro.showToast({title: 'pc端此功能只做模拟，具体请前往移动端体验！', duration: 3500, icon: 'none'})
      return false
    }
    return true
  }

  const handleOpen = async (e) => {
    if (!checkJump()) {
      return
    }
    if (e === 2) {
      setType(e)
      setIsOpened(true)
    }
    if (props.goods.length == 0) {
      return false;
    }
    if (props.groupDetail && e === 1) {
      if (props.isLogin) {
        const _id = props.goods[index].id
        if (value == 0) {
          Taro.showToast({
            title: '购买数量不能为0',
            icon: 'none',
            duration: 2000
          })
          return false;
        }
        const r = await http.postCondition(JORN_CAR, {id: _id, num: value, productId: props.productId})
        if (r) {
          props.onUpdata()
          Taro.showToast({
            title: '加入成功',
            icon: 'success',
            duration: 2000
          })
          setTimeout(function () {
            setIsOpened(false)
            setValue(props.goods[index].buy_num_min || 1)
          }, 500)
        }
        setTimeout(() => {
          setId(_id)
          setType(e)
        }, 500)
        return
      } else {
        user.jumpLogin()
        return false
      }
    }
    if (type == e) {
      if (isOpened) {
      } else {
        setValue(props.goods[index].buy_num_max >= 1 ? (props.goods[index].buy_num_min ? props.goods[index].buy_num_min : 1) : 0)
        setIsOpened(true)
      }
      setType(e)
    } else {
      for (let i = 0; i < props.goods.length; i++) {
        if (props.goods[i].isGoodsDayInfo == 1) {
          setIndex(i)
          break;
        }
      }
      if (isOpened) {
      } else {
        setValue(props.goods[index].buy_num_max >= 1 ? (props.goods[index].buy_num_min ? props.goods[index].buy_num_min : 1) : 0)
        setIsOpened(true)
      }
      setType(e)
    }
  }

  const getParams = () => {
    return `force_platform_seller=${props.forcePlatformSeller}&`
  }

  const sureBtn = async (kind = false) => {
    const _id = props.goods[index].id
    if (value == 0) {
      Taro.showToast({
        title: '购买数量不能为0',
        icon: 'none',
        duration: 2000
      })
      return false;
    }
    if (props.isLogin) {
      if (type && !kind) {
        setId(_id)
        const r = await http.postCondition(JORN_CAR, {id: _id, num: value, productId: props.productId})
        if (r) {
          props.onUpdata()
          Taro.showToast({
            title: '加入成功',
            icon: 'success',
            duration: 2000
          })
          setTimeout(function () {
            setIsOpened(false)
            setValue(props.goods[index].buy_num_min || 1)
          }, 500)
        } else {
          //失败
        }
      } else {
        const gooddate = {}
        gooddate['img'] = props.good.img
        gooddate['name'] = props.good.name
        gooddate['price'] = props.good.price
        gooddate['images'] = props.good.images
        if (props.goods && props.goods[index] && props.goods[index].market_price){
          props.good.market_price = props.goods[index].market_price
        }
        setId(_id)
        Taro.setStorage({
          key: "placeOrder",
          data: JSON.stringify(props.good),
          success: async function () {
            const query: any = Taro.getCurrentInstance().router.params;
            let step_num = 0
            let groupPrice = 0
            let id = _id
            let activity_id
            if (type === 2) {
              activity_id = props.groupDetail.activity_id
              if (props.groupDetail.activity_type === 3) {
                step_num = props.groupDetail['goods_step_list'][displayIndex].step_list[displayIndexTwo].step_num
                groupPrice = props.groupDetail['goods_step_list'][displayIndex].step_list[displayIndexTwo].group_price
                id = props.groupDetail['goods_step_list'][displayIndex].goods_id
              } else {
                id = props.groupDetail['goods_list'][displayIndex].goods_id
                groupPrice = props.groupDetail['goods_list'][displayIndex].group_price
              }
            } else {
              setType(1)
            }
            if (type === 2) {
              const data = await http.HPost(OPEN_ACTIVITY_CHECK, {activity_id})
              if (data.data !== '校验通过') {
                return
              }
            }
            Taro.navigateTo({
              url: `/main/order/place?${getParams()}itemId=` + id + '&m=product&num=' + value + (props.tempSellerId ? '&tempSellerId=' + props.tempSellerId : '') + '&env=' + query.env + (props.fromOrderNum ? `&fromOrderNum=${props.fromOrderNum}` : '') + `&activityId=${activity_id || ''}&isLeader=${isLeader}&stepNum=${step_num}&groupPrice=${groupPrice}&goodUuid=${props.goodUuid}` + `&limitGoodsId=${props.limitGoodsId}&goodsDiscountCodeType=${props.goodsDiscountCodeType}&goodsDiscountCodeId=${props.goodsDiscountCodeId}`
            })
          }
        })
      }
    } else {
      user.jumpLogin()
    }
  }
  const handleChange = (type, index) => {
    let val = value
    if (type) {
      if (props.goods[index].buy_num_max > val) {
        val++
      } else {
        Taro.showToast({
          title: '库存不足',
          icon: 'none',
          duration: 2000
        })
      }
    } else {
      if ((props.goods[index].buy_num_min || 1) < val) {
        val--
      }
    }
    setValue(val)
  }
  const choiceSpecs = (i) => {
    setIndex(i)
    setValue(props.goods[i].buy_num_min > value ? props.goods[i].buy_num_min : value)
    setId(props.goods[i].id)
  }
  const choiceSpecsTeam = (i) => {
    setDisplayIndex(i)
    setDisplayIndexTwo(0)
  }
  const choiceSpecsTeamTwo = (i) => {
    setDisplayIndexTwo(i)
  }

  const showImg = () => {
    const urls = []
    let img = ''
    if (props.goods.length > 0) {
      img = props.goods[index].main_img
      props.goods.map(item => {
        urls.push(item.main_img)
      })
    }
    Taro.previewImage({
      current: img, // 当前显示图片的http链接
      urls// 需要预览的图片http链接列表
    })
  }
  const env = Taro.getCurrentInstance().router.params.env;
  return (
    <View className='detailBar'>
      {props.goods.length > 0 &&
      <AtFloatLayout isOpened={isOpened} onClose={handleClose.bind(this)}>
        <View className='choiceInfo-top'>
          <Image className='left-img' mode='aspectFill' onClick={showImg.bind(this)}
            src={props.goods[index].main_img + '?x-oss-process=image/resize,w_240'}
          />
          <View className={`right-info ${type === 2 && 'team-right-info'}`}>
            <View className='price'>{type !== 2 ? '￥' : ''}{type !== 2 &&
            <Text className='new-price'>{props.goods[index].price}</Text>}
              {type === 2 && <Block>
                {props.groupDetail && <View className='p-t-price'>
                  {/* 老带新 */}
                  {(props.groupDetail.activity_type === 2 || props.groupDetail.activity_type === 1) && props.groupDetail['goods_list'] && props.groupDetail['goods_list'][displayIndex] &&
                  <View className='p-t-symbol-price'><Text className='symbol'>￥</Text>{!!props.groupDetail['goods_list'][displayIndex].discounts_price ? props.groupDetail['goods_list'][displayIndex].discounts_price : props.groupDetail['goods_list'][displayIndex].group_price}{!!props.groupDetail['goods_list'][displayIndex].discounts_price && <Text className='symbol' style='font-weight: bold;'>券后价</Text>}</View>}
                  {/* 阶梯 */}
                  {props.groupDetail.activity_type === 3 && props.groupDetail['goods_step_list'] && props.groupDetail['goods_step_list'][displayIndex] &&
                  <View className='p-t-symbol-price'><Text className='symbol'>￥</Text>{!!props.groupDetail['goods_step_list'][displayIndex].step_list[displayIndexTwo].discounts_price ? props.groupDetail['goods_step_list'][displayIndex].step_list[displayIndexTwo].discounts_price : props.groupDetail['goods_step_list'][displayIndex].step_list[displayIndexTwo].group_price}{!!props.groupDetail['goods_step_list'][displayIndex].step_list[displayIndexTwo].discounts_price && <Text className='symbol' style='font-weight: bold;'>券后价</Text>}</View>}
                  <View className='p-t-price-truth'>拼团{(props.groupDetail.activity_type === 3 && !props.groupDetail['goods_step_list'][displayIndex].step_list[displayIndexTwo].discounts_price) ? '价' : ''}{((props.groupDetail.activity_type === 1 || props.groupDetail.activity_type === 2) && !props.groupDetail['goods_list'][displayIndex].discounts_price) ? '价' : ''}</View>
                </View>
                }
              </Block>}
            </View>
            {type !== 2 ? <Block>
                {process.env.TARO_ENV !== 'tt' && process.env.P_ENV !== 'hiyogo' && !!platform.info.is_show_stock && <View className='selected'>库存: <Text>{props.goods[index].surplus_stock}件</Text></View>}
                {process.env.TARO_ENV === 'tt' && <View className='selected'>库存: <Text>{props.goods[index].surplus_stock}件</Text></View>}
                <View className='selected'>已选<Text>“{props.goods[index].name}”</Text></View>
                {process.env.DETAIL_SHOW_NO && !!props.isSeller && props.goods[index].no &&
                <View className='selected'>编号: <Text>{props.goods[index].no}</Text></View>}
              </Block>
              :
              <Block>
                {props.groupDetail &&
                <View className='price-box-price-stock'>
                  {/* 老带新 */}
                  {(props.groupDetail.activity_type === 2 || props.groupDetail.activity_type === 1) && <Block>
                    {props.groupDetail['goods_list'] && props.groupDetail['goods_list'][displayIndex] &&
                    <View className='stock'>价格 <Text className='symbol-price'><Text className='symbol'>￥</Text><Text
                      className='price'
                    >{props.groupDetail['goods_list'][displayIndex].goods_price}</Text></Text></View>}
                    {props.groupDetail && props.groupDetail['goods_list'] && props.groupDetail['goods_list'][displayIndex] &&
                    <View className='stock'>剩余 {props.groupDetail['goods_list'][displayIndex].surplus_stock} 件</View>}
                  </Block>}
                  {/* 阶梯 */}
                  {props.groupDetail.activity_type === 3 && <Block>
                    {props.groupDetail['goods_step_list'] && props.groupDetail['goods_step_list'][displayIndex] &&
                    <View className='stock'>价格 <Text className='symbol-price'><Text className='symbol'>￥</Text><Text
                      className='price'
                    >{props.groupDetail['goods_step_list'][displayIndex].goods_price}</Text></Text></View>}
                    {props.groupDetail && props.groupDetail['goods_step_list'] && props.groupDetail['goods_step_list'][displayIndex] &&
                    <View
                      className='stock'
                    >剩余 {props.groupDetail['goods_step_list'][displayIndex].surplus_stock} 件</View>}
                  </Block>}
                </View>
                }
              </Block>
            }
          </View>
          <View className='close-btn' onClick={handleClose.bind(this)}>
            <AtIcon value='close-circle' size='20' customStyle='font-size: 20px' color='#bfbfbf' />
          </View>
        </View>
        <View className='choiceInfo'>
          <View className='choice-specs'>
            {type !== 2 && <View className='choice-specs-title'>规格</View>}
            <View className='choice-specs-list'>
              {type !== 2 && props.goods.length > 0 && props.goods.map((item, i) =>
                <Block key={i}>
                  {(!!type || !!item.isGoodsDayInfo && item.isGoodsDayInfo == 1) &&
                  <Block>
                    {i == index ?
                      <Text onClick={choiceSpecs.bind(this, i)} className='choice-specs-item on'
                        key={i}
                      >{item.name}</Text>
                      : <Block>{item.surplus_stock > 0 ?
                        <Text onClick={choiceSpecs.bind(this, i)} className='choice-specs-item'
                          key={i}
                        >{item.name}</Text> :
                        <Text className='choice-specs-item disabled' key={i}>{item.name}</Text>}</Block>}
                  </Block>
                  }
                </Block>
              )}
              {type === 2 && props.groupDetail && <View className='group-spec-list'>
                {/* 老带新 */}
                {props.groupDetail && (props.groupDetail.activity_type === 2 || props.groupDetail.activity_type === 1) && props.groupDetail['goods_list'] &&
                <Block>{props.groupDetail['goods_list'].map((item, i) => <Text onClick={choiceSpecsTeam.bind(this, i)}
                  className={`choice-specs-item ${displayIndex === i && 'on'}`}
                  key={i}
                >{item.name}</Text>)}</Block>}
                {/* 阶梯 */}
                {props.groupDetail && props.groupDetail.activity_type === 3 && props.groupDetail['goods_step_list'] &&
                <Block>{props.groupDetail['goods_step_list'].map((item, i) => <Text
                  onClick={choiceSpecsTeam.bind(this, i)} className={`choice-specs-item ${displayIndex === i && 'on'}`}
                  key={i}
                >{item.name}</Text>)}</Block>}
                {props.groupDetail && props.groupDetail.activity_type === 3 && <View
                  className='group-type-list'
                >{props.groupDetail && props.groupDetail['goods_step_list'] && props.groupDetail['goods_step_list'][displayIndex] &&
                <View>
                  <View className='group-type'>拼团类型</View>
                  <View className='group-spec-list'>
                    {props.groupDetail['goods_step_list'][displayIndex].step_list.map((items, j) => <View
                      onClick={choiceSpecsTeamTwo.bind(this, j)}
                      className={`choice-specs-item ${displayIndexTwo === j && 'on'}`}
                      key={j}
                    ><Text className='price'>￥{items.group_price}</Text>/{items.people_num}人团</View>)}
                  </View>
                </View>}
                </View>
                }
              </View>}
            </View>
          </View>
          <View className='choice-num-box'>
            <View className='choice-num'>
              <View className='choice-num-title'>购买数量</View>
              <View className='at-input-number'>
                <View onClick={handleChange.bind(this, 0, index)}
                  className={props.goods[index].buy_num_min < value ? "at-input-number__btn" : "at-input-number__btn at-input-number--disabled"}
                ><AtIcon
                  value='subtract' size='10' customStyle='font-size: 10px'
                /></View>
                <View className='at-input-number__input'>{value}</View>
                <View onClick={handleChange.bind(this, 1, index)}
                  className={props.goods[index].buy_num_max > value ? "at-input-number__btn" : "at-input-number__btn at-input-number--disabled"}
                ><AtIcon
                  value='add' size='10' customStyle='font-size: 10px'
                /></View>
              </View>
            </View>
          </View>
        </View>

      </AtFloatLayout>
      }
      <View className={`detailBar othercar ${type === 2 && 'group-sureBtn'}`} style='background:#fff;'>
        {isOpened && props.goods.length > 0 ?
          <Block>
            {type === 2 && <View className='sureBtn' onClick={sureBtn.bind(this, true)}>下一步</View>}
            {type !== 2 && <View className='btn-box product-btn-box'>
              <View className='limit-group-btn'>
                <View className={`${!props.groupDetail && 'sureBtn limited'} ${props.groupDetail && 'buy-btn next'}`}
                  onClick={sureBtn.bind(this, !!props.groupDetail)}
                >确定</View>
                {props.groupDetail &&
                <View className={`${props.goodsDiscountCodeType && 'placeDisabled'} ${props.goods.length == 0 && "disabled"} buy-btn`} onClick={handleOpen.bind(this, 1)}>
                  <View className='top'>加入购物车</View>
                  {!!props.commissionPrice && <View className='bottom'>预计赚<Text className='dollar'>￥</Text><Text
                    className='true-price'
                  >{props.commissionPrice}</Text></View>}
                </View>}
              </View>
            </View>}
          </Block>
          :
          <Block>
            <View className={`service-box ${process.env.TARO_ENV}`}>
              {env != 'pc' && <View className='service-item goto-car' onClick={props.onGotoCar}>
                <View className='kefu'>
                  <AtIcon value='icon icon-shouye-01' size='20' customStyle='font-size: 20px' color='#000' />
                </View>
                <View className='text'>首页</View>
              </View>}
              { env != 'pc' && props.isShowShareButton && process.env.SHOW_SHARE_POSTER && <View className={`service-item ${!props.showService && 'no-kefu'}`} onClick={props.onGetPoster}>
                <View className='kefu'>
                  <AtIcon value='icon icon-fenxiang-01-01' size='20' customStyle='font-size: 20px' color='#000' />
                </View>
                {!!props.isSeller && process.env.DISTINGUISH_IDENTITY && <View className='text'>分享赚</View>}
                {(!props.isSeller || !process.env.DISTINGUISH_IDENTITY) && <View className='text'>分享</View>}
              </View> }
              {props.showService && (!props.qrImg || props.qrImg === 'variable_code_close') && <View className='service-item goto-service' onClick={props.onContact}>
                <View className='kefu'><AtIcon value='icon icon-kefu-01' customStyle='font-size: 20px' size='20' color='#000' /></View>
                <View className='text'>客服</View>
              </View>}
              {props.showService && (props.qrImg && props.qrImg !== 'variable_code_close') && <View className='service-item goto-service' onClick={()=>{ setModalShow(true) }}>
                <View className='kefu'><AtIcon value='icon icon-kefu-01' customStyle='font-size: 20px' size='20' color='#000' /></View>
                <View className='text'>客服</View>
              </View>}
            </View>
            <View className={`right-btn-box ${(!props.isPub) && 'right-btn-box-border-r'}`}>
              {props.isPub ? <Block>
                  {props.isSale == 1 ?
                    <View
                      className={`box-wrapper ${((!(!!props.isPub && !!props.isSale && props.canpay)) || !props.groupDetail) && 'box-wrapper-groupDetail'}`}
                    >
                      <View className='capsules product-capsules'>
                        {!props.groupDetail && props.goods.length > 0 && !!props.isPub && !!props.isSale && props.canpay && <View
                          className={`${props.goodsDiscountCodeType && 'placeDisabled'}  ${props.goods.length == 0 ? "goto-car-btn disabled" : "goto-car-btn"} ${!props.groupDetail && 'share'}`}
                          onClick={handleOpen.bind(this, 1)}
                        >
                          <View className='top'>加入购物车</View>
                          {process.env.DISTINGUISH_IDENTITY && !!props.commissionPrice && props.isShowShareButton && <View className='bottom'>分享赚<Text className='dollar'>￥</Text><Text
                            className='true-price'
                          >{props.commissionPrice}</Text></View>}
                        </View>}
                        {props.canpay ? <View
                          className={`${props.goods.length == 0 ? "goto-buy-btn disabled" : "goto-buy-btn"}  ${props.groupDetail ? 'share' : 'limited'}`}
                          onClick={handleOpen.bind(this, 0)}
                        >
                            <View className='top'>{props.groupDetail ? '单独购买' : '立即购买'}</View>
                            {props.groupDetail && <View className='bottom'><Text className='dollar'>￥</Text><Text
                              className='true-price'
                            >{props.info.goodsList[0].price}</Text></View>}
                            {process.env.DISTINGUISH_IDENTITY && !props.groupDetail && !!props.commissionPrice &&
                            <View className='bottom'>购买返<Text className='dollar'>￥</Text><Text
                              className='true-price'
                            >{props.commissionPrice}</Text></View>}
                          </View>
                          :
                          <View className='capsules'>
                            <View className='disabled noGroupDetail limited font-write'>即将开售</View>
                          </View>
                        }
                      </View>
                    </View>
                    :
                    <Block>
                      <View className='capsules'><View className='disabled noGroupDetail limited'>已售罄</View></View>
                    </Block>
                  }
                </Block>
                :
                <Block>
                  <View className='capsules'>
                    <View className='disabled noGroupDetail limited'>已下架</View>
                  </View>
                </Block>
              }
              {props.groupDetail && !!props.isPub && !!props.isSale && props.canpay &&
              <View className={`box-wrapper ${(!props.isPub) && 'no-sale'}`}>
                <View className='capsules product-capsules'>
                  {!props.groupDetail.is_join && props.groupDetail.is_share === '0' &&
                  <View className='goto-buy-btn limited' onClick={handleOpen.bind(this, 2)}>
                    <View className='top'>立即开团</View>
                    <View className='bottom'><Text className='dollar'>￥</Text><Text
                      className='true-price'
                    >{props.groupDetail.group_price}</Text></View>
                  </View>}
                  {!!props.groupDetail.is_join &&
                  <View className='goto-buy-btn limited' onClick={async () => {
                    if (!(await user.checkLogin())) {
                      user.jumpLogin()
                    } else {
                      Taro.navigateTo({url: `/common/group/detail?orderNum=${props.groupDetail.order_num}&category=4&itemId=${props.goodUuid}`})
                    }
                  }}
                  >
                    <View className='top'>查看我的团</View>
                  </View>}
                  {!props.groupDetail.is_join && props.isLogin && props.groupDetail.is_share === '1' &&
                  <View className='goto-buy-btn limited' onClick={async () => {
                    const data = await http.HPost(ACTIVITY_CHECK, {group_buy_id: props.groupBuyId})
                    if (!data) {
                      return
                    }
                    if (!(await user.checkLogin())) {
                      user.jumpLogin()
                    } else {
                      const query: any = Taro.getCurrentInstance().router.params;
                      Taro.navigateTo({
                        url: `/main/order/place?${getParams()}itemId=` + props.groupDetail.goods_id + '&m=product&num=' + 1 + (props.tempSellerId ? '&tempSellerId=' + props.tempSellerId : '') + '&env=' + query.env + (props.fromOrderNum ? `&fromOrderNum=${props.fromOrderNum}` : '') + `&activityId=${props.groupDetail.activity_id || ''}&isLeader=${false}&stepNum=${props.groupDetail.step_num}&groupPrice=${props.groupDetail.goods_price}&goodUuid=${props.goodUuid}&groupBuyId=${props.groupDetail.group_buy_id}`
                      })
                    }
                  }}
                  >
                    <View className='top'>立即参团</View>
                  </View>}
                </View>
              </View>
              }
            </View>
          </Block>}
        {modalShow && <AtModal className='modal_concatWx' isOpened={Boolean(modalShow)} onClose={()=>{ setModalShow(false) }}>
          <AtModalHeader>{props.qrImgDescribe}</AtModalHeader>
          <AtModalContent>
            {props.qrImg && <Image
              style='width: 120px;height: 120px;'
              src={props.qrImg}
              mode='aspectFill'
            />}
          </AtModalContent>
          <AtModalAction>
            {process.env.TARO_ENV === 'h5' && <Text className='modal_txt'>
              有任何问题可添加<br />
              您的专属顾问进行咨询
            </Text>}
            {process.env.TARO_ENV !== 'h5' && <Text className='modal_txt'>
              有任何问题可添加\n
              您的专属顾问进行咨询
            </Text>}
          </AtModalAction>
        </AtModal>
        }
      </View>
    </View>
  );
}
OtherCar.defaultProps = {
  good: {},
  isPub: 1,
  groupDetail: null,
  productId: '0',
  carSum: 0,
  limitGoodsId: '',
  goodsDiscountCodeType: '',
  goodsDiscountCodeId: '',
  fromOrderNum: '',
  num: 1,
  isSeller: 0,
  goods: [{main_img: ''}],
  isOpened: false,
  isSale: 1,
  isLogin: false,
  thisIndex: 0,
  commissionPrice: 0,
  orderCar: {
    forCar: false,
    isOpen: false,
    index: 0,
  },
  canpay: true,
  leader: true,
  tempSellerId: '',
  goodUuid: ''
}

export default OtherCar
